import java.io.IOException;
import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.util.Scanner;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.ipc.RPC;

public class RPCClient {
    /*
    private static final String HOST = "localhost";
    private static final int PORT = 2181;

    public static void main(String[]args){
        try {
            MyInterface proxy = RPC.getProxy(MyInterface.class, 1L,
                    new InetSocketAddress(HOST, PORT),
                    new Configuration());

            int res = proxy.add(1, 2);
            System.out.println(res);

        } catch (IOException e) {
            e.printStackTrace();

        }
    }


*/
    public static void main(String[] args) throws IOException {
        InetSocketAddress address = new InetSocketAddress(InetAddress.getByName("localhost"), 4893);
        MyInterface interfaceProxy = RPC.getProxy(MyInterface.class, MyInterface.versionID, address, new Configuration());
        Scanner inputReader = new Scanner(System.in);
        System.out.println("Enter your student ID: ");
        long id = inputReader.nextLong();
        //String result = interfaceProxy.sayHi(Integer.toString(id));
        String result = interfaceProxy.findName(id);
        System.out.println(result);
    }


}